<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button type="button" onclick="getpost()">POST</button>
		<div id="div1">
			    <h4 id="title" style="text-align: center;"></h4>
				<h3 id="dynasty"></h3>
				<div id="content">
					
				</div>
		</div>
	</body>
	<script type="text/javascript">
		function getpost(){
			var ajax = new XMLHttpRequest();
			ajax.open('POST','http://poetry.apiopen.top/poetry?count=2&page=1')
			ajax.send()
			ajax.onreadystatechange = function(){
				if(ajax.readyState==4 && ajax.status==200){
					var obj = JSON.parse(ajax.responseText)
					if(obj.code == 200&&obj.message=="成功!"){;
						document.getElementById('title').innerHTML=obj.result[0].title;
						document.getElementById('dynasty').innerHTML=obj.result[0].dynasty;
						document.getElementById('content').innerHTML = obj.result[0].content
						console.log(obj.result)
					}
				}
			}			
		}
	</script>
</html>
